home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / BlitzList / BlitzListFiles / BlitzC2P.lha / programming / blitz2 / programs / c2p040only.ascii < prev    next >
Encoding:
Text File  |  1998-07-27  |  6.6 KB  |  411 lines

  1. WBStartup
  2. NoCli
  3.  
  4. ; 040/25 results:
  5.  
  6. ; 320x200 @49.65fps DoublePAL or 55.3fps PAL
  7. ; 320x256 @36.2fps DoublePAL or 42.5fps PAL
  8. ; 320x240 @39.5fps DoublePAL or 45.5fps PAL
  9.  
  10. ; 060/50 results:
  11.  
  12. ; 320x256 @50fps PAL
  13. ; 320x200 @66.1fps PAL
  14.  
  15. #c2pBPLX=320
  16. #c2pBPLY=256
  17. #c2pBPLSIZE=(#c2pBPLX*#c2pBPLY)/8
  18.  
  19. #scrwidth=#c2pBPLX
  20. #scrheight=#c2pBPLY
  21. #screensize=#scrwidth*#scrheight
  22.  
  23. ; c2p1x1_8_c5_040
  24.  
  25. ; 110% on 040-25
  26.  
  27. Statement c2p040onlyinit{A.l,B.l}
  28.  
  29.   ;A.l=d0=Width.w
  30.   ;B.l=d1=Height.w
  31.  
  32. ; d0.w  chunkyx [chunky-pixels]
  33. ; d1.w  chunkyy [chunky-pixels]
  34. ; d3.w  scroffsy [screen-pixels]
  35.  
  36. c2p1x1_8_c5_040_init
  37.   LEA c2p_datanew(pc),a0
  38.   ANDI.l  #$ffff,d0
  39.   MULU.w  d0,d3
  40.   LSR.l #3,d3
  41.   MOVE.l  d3,c2p_scroffs-c2p_data(a0)
  42.   MULU.w  d0,d1
  43.   MOVE.l  d1,c2p_pixels-c2p_data(a0)
  44. AsmExit
  45. End Statement
  46.  
  47. Statement c2p040only{A.l,B.l}
  48.  
  49.   MOVE.l  d0,a0 ; Chunky
  50.   MOVE.l  d1,a1 ; Planar
  51.  
  52. ; a0  c2pscreen
  53. ; a1  bitplanes
  54.  
  55. c2p1x1_8_c5_040
  56.   MOVEM.l a3-a6,-(a7)
  57.  
  58.   MOVEM.l a0-a1,-(a7)
  59.   LEA c2p_datanew,a0
  60.   LEA c2p_data,a1
  61.   MOVEQ #16-1,d0
  62. _c2pcopy: MOVE.l  (a0)+,(a1)+
  63.   DBF d0,_c2pcopy
  64.   MOVEM.l (a7)+,a0-a1
  65.  
  66.   LEA c2p_data(pc),a2
  67.  
  68.   MOVE.l  c2p_pixels-c2p_data(a2),a3
  69.   ADD.l a0,a3
  70.  
  71.   ADD.w #c2pBPLSIZE,a1
  72.   ADD.l c2p_scroffs-c2p_data(a2),a1
  73.   MOVE.l  a1,a2
  74.   ADD.l #c2pBPLSIZE*4,a2
  75.  
  76.   MOVE.l  (a0)+,d0
  77.   MOVE.l  (a0)+,d1
  78.   MOVE.l  (a0)+,d2
  79.   MOVE.l  (a0)+,d3
  80.   MOVE.l  (a0)+,d4
  81.   MOVE.l  (a0)+,d5
  82.  
  83.   MOVE.l  d4,d7     ; Swap 16x4, part 1
  84.   MOVE.w  d0,d4
  85.   SWAP  d4
  86.   MOVE.w  d4,d0
  87.   MOVE.w  d7,d4
  88.   MOVE.l  d5,d7
  89.   MOVE.w  d1,d5
  90.   SWAP  d5
  91.   MOVE.w  d5,d1
  92.   MOVE.w  d7,d5
  93.  
  94.   MOVE.l  d4,d7     ; Swap 2x4, part 1
  95.   LSR.l #2,d7
  96.   EOR.l d0,d7
  97.   AND.l #$33333333,d7
  98.   EOR.l d7,d0
  99.   LSL.l #2,d7
  100.   EOR.l d7,d4
  101.   MOVE.l  d5,d7
  102.   LSR.l #2,d7
  103.   EOR.l d1,d7
  104.   AND.l #$33333333,d7
  105.   EOR.l d7,d1
  106.   LSL.l #2,d7
  107.   EOR.l d7,d5
  108.  
  109.   MOVE.l  (a0)+,a5
  110.   MOVE.l  (a0)+,a6
  111.  
  112.   EXG d4,a5
  113.   EXG d5,a6
  114.  
  115.   MOVE.l  d4,d7     ; Swap 16x4, part 2
  116.   MOVE.w  d2,d4
  117.   SWAP  d4
  118.   MOVE.w  d4,d2
  119.   MOVE.w  d7,d4
  120.   MOVE.l  d5,d7
  121.   MOVE.w  d3,d5
  122.   SWAP  d5
  123.   MOVE.w  d5,d3
  124.   MOVE.w  d7,d5
  125.  
  126.   MOVE.l  d4,d7     ; Swap 2x4, part 2
  127.   LSR.l #2,d7
  128.   EOR.l d2,d7
  129.   AND.l #$33333333,d7
  130.   EOR.l d7,d2
  131.   LSL.l #2,d7
  132.   EOR.l d7,d4
  133.   MOVE.l  d5,d7
  134.   LSR.l #2,d7
  135.   EOR.l d3,d7
  136.   AND.l #$33333333,d7
  137.   EOR.l d7,d3
  138.   LSL.l #2,d7
  139.   EOR.l d7,d5
  140.  
  141.   MOVE.l  d1,d7     ; Swap 4x1
  142.   LSR.l #4,d7
  143.   EOR.l d0,d7
  144.   AND.l #$0f0f0f0f,d7
  145.   EOR.l d7,d0
  146.   LSL.l #4,d7
  147.   EOR.l d7,d1
  148.   MOVE.l  d3,d7
  149.   LSR.l #4,d7
  150.   EOR.l d2,d7
  151.   AND.l #$0f0f0f0f,d7
  152.   EOR.l d7,d2
  153.   LSL.l #4,d7
  154.   EOR.l d7,d3
  155.  
  156.   BRA _start
  157. _x
  158.   MOVE.l  (a0)+,d0
  159.   MOVE.l  (a0)+,d1
  160.   MOVE.l  (a0)+,d2
  161.   MOVE.l  (a0)+,d3
  162.   MOVE.l  (a0)+,d4
  163.   MOVE.l  (a0)+,d5
  164.  
  165.   MOVE.l  a6,-c2pBPLSIZE(a1)
  166.  
  167.   MOVE.l  d4,d7     ; Swap 16x4, part 1
  168.   MOVE.w  d0,d4
  169.   SWAP  d4
  170.   MOVE.w  d4,d0
  171.   MOVE.w  d7,d4
  172.   MOVE.l  d5,d7
  173.   MOVE.w  d1,d5
  174.   SWAP  d5
  175.   MOVE.w  d5,d1
  176.   MOVE.w  d7,d5
  177.  
  178.   MOVE.l  d4,d7     ; Swap 2x4, part 1
  179.   LSR.l #2,d7
  180.   EOR.l d0,d7
  181.   AND.l #$33333333,d7
  182.   EOR.l d7,d0
  183.   LSL.l #2,d7
  184.   EOR.l d7,d4
  185.   MOVE.l  d5,d7
  186.   LSR.l #2,d7
  187.   EOR.l d1,d7
  188.   AND.l #$33333333,d7
  189.   EOR.l d7,d1
  190.   LSL.l #2,d7
  191.   EOR.l d7,d5
  192.  
  193.   MOVE.l  (a0)+,d7
  194.   MOVE.l  (a0)+,a6
  195.  
  196.   MOVE.l  a5,-c2pBPLSIZE(a2)
  197.  
  198.   MOVE.l  d7,a5
  199.   EXG d4,a5
  200.   EXG d5,a6
  201.  
  202.   MOVE.l  d4,d7     ; Swap 16x4, part 2
  203.   MOVE.w  d2,d4
  204.   SWAP  d4
  205.   MOVE.w  d4,d2
  206.   MOVE.w  d7,d4
  207.   MOVE.l  d5,d7
  208.   MOVE.w  d3,d5
  209.   SWAP  d5
  210.   MOVE.w  d5,d3
  211.   MOVE.w  d7,d5
  212.  
  213.   MOVE.l  d4,d7     ; Swap 2x4, part 2
  214.   MOVE.l  d6,(a2)+
  215.   LSR.l #2,d7
  216.   EOR.l d2,d7
  217.   AND.l #$33333333,d7
  218.   EOR.l d7,d2
  219.   LSL.l #2,d7
  220.   EOR.l d7,d4
  221.   MOVE.l  d5,d7
  222.   LSR.l #2,d7
  223.   EOR.l d3,d7
  224.   AND.l #$33333333,d7
  225.   EOR.l d7,d3
  226.   LSL.l #2,d7
  227.   EOR.l d7,d5
  228.  
  229.   MOVE.l  d1,d7     ; Swap 4x1
  230.   LSR.l #4,d7
  231.   EOR.l d0,d7
  232.   MOVE.l  a4,(a1)+
  233.   AND.l #$0f0f0f0f,d7
  234.   EOR.l d7,d0
  235.   LSL.l #4,d7
  236.   EOR.l d7,d1
  237.   MOVE.l  d3,d7
  238.   LSR.l #4,d7
  239.   EOR.l d2,d7
  240.   AND.l #$0f0f0f0f,d7
  241.   EOR.l d7,d2
  242.   LSL.l #4,d7
  243.   EOR.l d7,d3
  244. _start
  245.  
  246.   MOVE.l  d2,d7     ; Swap 8x2, part 1
  247.   LSR.l #8,d7
  248.   EOR.l d0,d7
  249.   AND.l #$00ff00ff,d7
  250.   EOR.l d7,d0
  251.   LSL.l #8,d7
  252.   EOR.l d7,d2
  253.   MOVE.l  d2,d7
  254.   LSR.l #1,d7     ; Swap 1x2, part 1
  255.   EOR.l d0,d7
  256.   AND.l #$55555555,d7
  257.   EOR.l d7,d0
  258.   MOVE.l  d0,c2pBPLSIZE*2(a2)
  259.   ADD.l d7,d7
  260.   EOR.l d7,d2
  261.   MOVE.l  d3,d7     ; Swap 8x2, part 2
  262.   LSR.l #8,d7
  263.   EOR.l d1,d7
  264.   AND.l #$00ff00ff,d7
  265.   EOR.l d7,d1
  266.   LSL.l #8,d7
  267.   EOR.l d7,d3
  268.   MOVE.l  d3,d7
  269.   LSR.l #1,d7     ; Swap 1x2, part 2
  270.   EOR.l d1,d7
  271.   AND.l #$55555555,d7
  272.   EOR.l d7,d1
  273.   MOVE.l  d1,c2pBPLSIZE*2(a1)
  274.   ADD.l d7,d7
  275.   EOR.l d7,d3
  276.  
  277.   MOVE.l  d5,d7
  278.   LSR.l #4,d7
  279.   EOR.l d4,d7
  280.   AND.l #$0f0f0f0f,d7
  281.   EOR.l d7,d4
  282.   LSL.l #4,d7
  283.   EOR.l d7,d5
  284.  
  285.   EXG d4,a5
  286.   EXG d5,a6
  287.  
  288.   MOVE.l  d5,d7
  289.   LSR.l #4,d7
  290.   EOR.l d4,d7
  291.   AND.l #$0f0f0f0f,d7
  292.   EOR.l d7,d4
  293.   LSL.l #4,d7
  294.   EOR.l d7,d5
  295.  
  296.   MOVE.l  a5,d0
  297.   MOVE.l  a6,d1
  298.   MOVE.l  d2,c2pBPLSIZE(a2)
  299.  
  300.  
  301.   MOVE.l  d0,d7     ; Swap 8x2, part 3
  302.   LSR.l #8,d7
  303.   EOR.l d4,d7
  304.   AND.l #$00ff00ff,d7
  305.   EOR.l d7,d4
  306.   LSL.l #8,d7
  307.   EOR.l d7,d0
  308.   MOVE.l  d0,d7
  309.   LSR.l #1,d7     ; Swap 1x2, part 3
  310.   EOR.l d4,d7
  311.   AND.l #$55555555,d7
  312.   EOR.l d7,d4
  313.   ADD.l d7,d7
  314.   EOR.l d7,d0
  315.   MOVE.l  d1,d7     ; Swap 8x2, part 4
  316.   LSR.l #8,d7
  317.   MOVE.l  d3,c2pBPLSIZE(a1)
  318.   EOR.l d5,d7
  319.   AND.l #$00ff00ff,d7
  320.   EOR.l d7,d5
  321.   LSL.l #8,d7
  322.   EOR.l d7,d1
  323.   MOVE.l  d1,d7
  324.   LSR.l #1,d7     ; Swap 1x2, part 4
  325.   EOR.l d5,d7
  326.   AND.l #$55555555,d7
  327.   EOR.l d7,d5
  328.   ADD.l d7,d7
  329.   EOR.l d7,d1
  330.  
  331.   MOVE.l  d0,a5
  332.   MOVE.l  d1,a6
  333.  
  334.   MOVE.l  d4,d6
  335.   MOVE.l  d5,a4
  336.  
  337.   CMP.l a0,a3
  338.   BNE _x
  339.  
  340.   MOVE.l  a6,-c2pBPLSIZE(a1)
  341.   MOVE.l  a5,-c2pBPLSIZE(a2)
  342.   MOVE.l  d6,(a2)+
  343.   MOVE.l  a4,(a1)+
  344.  
  345.   MOVEM.l (a7)+,a3-a6
  346. AsmExit
  347.  
  348.   Even4
  349. c2p_data
  350. c2p_scroffs: Dc.l 0
  351. c2p_pixels: Dc.l 0
  352.   Ds.l  16
  353.   Even4
  354. c2p_datanew
  355.   Ds.l  16
  356. End Statement
  357.  
  358.  
  359.  
  360.  
  361. .blitzprogram
  362. ; Setup
  363. InitBank 0,(#scrwidth*#scrheight)+1000,2|65536 ; Chipram planar buffer
  364. CludgeBitMap 0,#scrwidth,#scrheight,8,Bank(0)
  365. InitPalette 0,256
  366. For c=0 To 255
  367.   AGAPalRGB 0,c,Rnd(c),Rnd(c),Rnd(c)
  368. Next c
  369. AGAPalRGB 0,0,0,0,0
  370. Screen 0,0,0,#scrwidth,#scrheight,8,0,"c2p test",0,0,0
  371. Use Palette 0
  372. VWait 50
  373. baseaddress1.l=AllocMem(#scrwidth*#scrheight,$10000) ; Fastram chunky buffer
  374.  
  375. ; Put something into the chunky buffer so we can see it working
  376. GetReg a0,baseaddress1
  377. MOVE.l  #0,d0
  378. MOVE.l  #screensize-1,d1
  379. cloop
  380.   MOVE.b  d0,(a0)+
  381.   ADDQ.l  #1,d0
  382.   SUBQ.l  #1,d1
  383.   TST.l   d1
  384.   BLT     done
  385.   BRA     cloop
  386. done
  387.  
  388. ; Do the c2p test
  389. c2p040onlyinit{#scrwidth,#scrheight}
  390. VWait 20
  391. Forbid_
  392. VWait
  393. ResetTimer
  394. For time=1 To 800
  395.   c2p040only{baseaddress1,Bank(0)} ; Convert chunky to planar
  396. Next time
  397. t=Ticks
  398. VWait 2 : Permit_
  399. VWait 20
  400. FindScreen 0
  401. Window 0,0,11,640,100,0,"Test results for c2p",0,0
  402. WindowOutput 0
  403. NPrint "Routine performed @ ",50/(t/800),"fps - ",t," ticks"
  404. NPrint " "
  405. NPrint "Press mousebutton..."
  406. Free Screen 0
  407. MouseWait
  408. Free Window 0
  409. End
  410.  
  411.